beginoutdoorscript;

variables;
short choice = 0;

body;

beginstate 0; //INIT_STATE
break;

beginstate 1; //EXIT_STATE
break;

beginstate 2; //START_STATE
break;

beginstate 10; //seeing the ocean
	if(get_flag(50,0) == 1)
		end();
	reset_dialog();
	add_dialog_str(0,"The sea breeze hits you full in the face as you leave the forest's shelter and stroll towards the shore. It's hard to imagine anything being wrong in such an idyllic location.",0);
	add_dialog_str(1,"Oh well, it's not like you're surprised. You're adventurers, and trouble seems to seek you out everywhere you go.",0);
	add_dialog_str(2,"At least it pays the bills.",0);
	run_dialog(1);
	set_flag(50,0,1);
break;

beginstate 15; //farms
	if(get_flag(50,1) == 1)
		end();
	reset_dialog();
	add_dialog_str(0,"A few farmhouses are scattered around this clearing, surrounded by healthy-looking crops.",0);
	add_dialog_str(1,"You stop for a while to talk with the farmers, but don't learn anything relevant to your quest.",0);
	run_dialog(1);
	set_flag(50,1,1);
break;

beginstate 20; //guard tower
	if(get_flag(50,2) == 1)
		end();
	reset_dialog();
	add_dialog_str(0,"A tall wooden watchtower watches over the harbor, firmly anchored in the sand. You can see a few guards at the top.",0);
	add_dialog_str(1,"Aside from the garrison in Stonesthrow, this is the island's only defense, making the potential Loyalist threat even more frightening. If they can besiege one island, what's stopping them from besieging the rest?",0);
	run_dialog(1);
	set_flag(50,2,1);
break;

beginstate 25; //the tinker

	block_entry(1);

	choice = 0;
	reset_dialog();
	if(get_flag(50,3) == 0) {
		if(in_boat() != -1)
			add_dialog_str(0,"You make your way along the shore of this small island, and find a few small wooden shacks.",0);
		else
			add_dialog_str(0,"You guide your rickety boat up to the shore of this small island, and find a few small wooden shacks.",0);
		add_dialog_str(1,"It's not long before a man comes out of the nearest shack and greets you. His clothes are singed in places, and you can see a few prominent scars on his arms.",0);
		add_dialog_str(2,"_Hey there, the name's Demarkus. I'm a tinker, and this is my workshop. I buy, I sell, and I make things._",15);
		add_dialog_str(3,"_Of course, I'm not so sure the things I make would be useful to adventurer types like you, but I'm sure you've got some gear you want to unload._",15);
		set_flag(50,3,1);
		}
	else
		add_dialog_str(0,"You return to Demarkus's workshop, and it's not long before he comes out to greet you.",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Do some shopping.");
	choice = run_dialog(1);
	if(choice == 2)
		begin_shop_mode("Demarkus's Workshop","Demarkus has an eclectic array of gear available, and he's willing to buy any extra equipment you've found.",3,3,4);
break;

beginstate 30; //empty farmhouse
	if(get_flag(50,4) == 1)
		end();
	reset_dialog();
	add_dialog_str(0,"You find a rickety-looking farmhouse on this island, next to an untended plot of crops. It looks like there hasn't been anyone living here for months, at least.",0);
	add_dialog_str(1,"Once you're sure that nobody is around, you take a look inside the building, only to find that it has already been cleared out.",0);
	run_dialog(1);
	set_flag(50,4,1);
break;

beginstate 35; //sand runes
	if(get_flag(50,5) == 1)
		end();
	if(has_item(445) == 0)
		end();

	reset_dialog();
	add_dialog_str(0,"The key you got from the crazy hermit starts vibrating in your pack, and you see a wisp of smoke drifting across the beach. Then the smoke thickens, and a pair of imps appear from thin air.",0);
	add_dialog_str(1,"They don't look friendly.",0);
	run_dialog(1);
	
	create_out_spec_enc(0);
	
	set_flag(50,5,1);

break;

beginstate 36; //sand runes fight
	set_out_fight_town_loaded(13);
break;